import 'package:flutter/material.dart';

class GridExtendView extends StatelessWidget {
  const GridExtendView({super.key});

  @override
  Widget build(BuildContext context) {
    return GridView.extent(
      maxCrossAxisExtent: 100,//设置水平方向子元素的最大宽度
      children: [
        Container(
          color: Colors.orange,
        ),
        Container(
          color: Colors.red,
        ),
        Container(
          color: Colors.green,
        ),
        Container(
          color: Colors.blue,
        ),
        Container(
          color: Colors.yellow,
        ),
        Container(
          color: Colors.purple,
        ),
        Container(
          color: Colors.pink,
        ),
        Container(
          color: Colors.brown,
        ),
        Container(
          color: Colors.teal,
        ),
        Container(
          color: Colors.cyan,
        ),
      ],
    );
  }
}
